﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>草稿</title>
    <link href="Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/bootstrap/css/font-awesome.css" rel="stylesheet">
    <link href="Style/skin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="Style/skin/css/animate.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="./Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="./Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="./Scripts/QueryString.js" type="text/javascript"></script>
    <script src="./Scripts/config.js" type="text/javascript"></script>
    <script src="./Comm/Gener.js" type="text/javascript"></script>
    <script src="Scripts/layui/layui/lay/modules/layer.js" type="text/javascript"></script>
</head>

<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox-content">
            <table class="table  table-striped">
                <thead>

                <th> # </th>
                <th> 标题</th>
                <th> 流程</th>
                <th>发起日期</th>
                <th>发起人</th>
                <th>停留节点</th>
                <th>挂起时间</th>
                <th>挂起人</th>
                <th>挂起方式</th>
                <th>备注 </th>
                <th> 操作</th>

                </thead>
                <tbody id="Table1">
                </tbody>
            </table>
        </div>
    </div>

    <script language="javascript" type="text/javascript">
        function WinOpenIt(url) {
            window.open(url);
            return;

            layer.open({
                skin: 'layer-class',
                type: 2,
                title: '挂起',
                area: ['96%', '90%'],
                content: url
            });

        }

        /* ESC Key Down */
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }

        //页面启动函数.
        $(function () {
            InitPage();

        });

        //初始化数据.
        function InitPage() {

            var handler = new HttpHandler("BP.WF.HttpHandler.WF");
            var data = handler.DoMethodReturnString("HungupList_Init");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            var timeKey = Math.random();
            data = JSON.parse(data);
            var listbox = '';
            //增加处理.
            var idx = 0;
            for (var i = 0; i < data.length; i++) {

                idx++;
                var en = data[i];
                en = new Entity("BP.WF.GenerWorkFlow", en);
                //var title = en.Title;
                //var flowNo = en.FK_Flow;
                //var flowName = en.FlowName;
                //var rdt = en.RDT;
                //var flowNote = en.FlowNote;
                //var workID = en.WorkID;
                var paras = en.AtPara; //参数.
                // AtPara ap = new AtPara(paras);
                if (paras != '' && paras != null) {
                    paras = paras.replace("'", "\\'");
                    paras = paras.replace('@', '&');
                    paras = paras.replace('@', '&');
                    paras = paras.replace('@', '&');
                    paras = paras.replace('@', '&');
                    paras = paras.replace('@', '&');
                    paras = "1" + paras;
                }

                listbox = "<tr ><td class=Idx >" + idx + "</td>";
                listbox += "<td>" + "<a href=\"javascript:WinOpenIt('MyView.htm?FK_Flow=" + en.FK_Flow + "&FID=0&WorkID=" + en.WorkID + "&IsRead=0&Paras=" + paras + "&T=" + timeKey + "');\" ><img src='./Img/Mail_UnRead.png' border=0 />" + en.Title + "</a></td>";
                listbox += "<td>" + en.FlowName + "</td>";
                listbox += "<td>" + en.RDT + "</td>";

                listbox += "<td>" + en.StarterName + "</td>";
                listbox += "<td>" + en.NodeName + "</td>";
                listbox += "<td>" + en.HungupTime + "</td>";
                listbox += "<td>" + en.GetPara('HunguperName') + "</td>"; //挂起人.
                if (en.GetPara('HungupWay') == 0)
                    listbox += "<td> 永久挂起</td>";
                else
                    listbox += "<td>在<font color=green >" + en.GetPara('HungupRelDate') + "</font> 解除</td>";

                listbox += "<td>" + en.GetPara('HungupNote') + "</td>"; //挂起原因.

                //   listbox += "<td>" + en. + "</td>";

                listbox += "<td>";

                if (en.GetPara("HungupCheckSta") == 1) {
                    listbox += "<font color=green> 已经同意 </a>";

                } else {
                    listbox += "<a href=\"javascript:Agree('" + en.FK_Flow + "','" + en.WorkID + "')\">同意</a> - ";
                    listbox += "<a href=\"javascript:Reject('" + en.FK_Flow + "','" + en.WorkID + "')\">不同意</a>";
                }

                listbox += "</td>";
                listbox += "</tr>";

                $('#Table1').append(listbox);
            }
        }

        function Reject(flowNo, workid) {
            var msg = window.prompt('输入要拒绝的原因？');
            if (msg) {
                var handler = new HttpHandler("BP.WF.HttpHandler.WF");
                handler.AddPara("WorkID", workid);
                handler.AddPara("FK_Flow", flowNo);
                handler.AddPara("Msg", msg);
                var data = handler.DoMethodReturnString("HungupList_Reject");

                if (data.indexOf('err@') == 0) {
                    alert(data);
                    return;
                }

                Reload();
            }
        }

        //删除流程.
        function Agree(flowNo, workid) {

            if (window.confirm('您确定要同意吗？') == false)
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF");
            handler.AddPara("WorkID", workid);
            handler.AddPara("FK_Flow", flowNo);
            var data = handler.DoMethodReturnString("HungupList_Agree");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            //删除流程.
            alert(data);

            Reload();
        }
    </script>

</body>
</html>
